package vip.sone.eureka.consumer;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * `@EnableHystrix、@EnableCircuitBreaker`使用一个即可 开启Hystrix(断路器)的使用
 * 还可以使用@SpringCloudApplication注解代替以下三个注解
 *
 * @author winstone jianwenzhen@qq.com
 * @date 19-4-12 下午4:30
 */
@EnableHystrix
//@EnableCircuitBreaker
//@EnableDiscoveryClient
//@SpringBootApplication
@SpringCloudApplication
public class EurekaConsumerRibbonHystrix2Application {

	public static void main(String[] args) {
		SpringApplication.run(EurekaConsumerRibbonHystrix2Application.class, args);
	}

	@Bean
	@LoadBalanced
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}

}
